package com.csi.bumblebee.service.impl;

import com.csi.bumblebee.domain.manage.AccountRole;
import com.csi.bumblebee.mapper.AccountRoleMapper;
import com.csi.bumblebee.service.AccountRoleService;
import com.csi.bumblebee.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author HUOJT
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class AccountRoleServiceImpl implements AccountRoleService {

    @Autowired
    private AccountRoleMapper accountRoleMapper;

    @Override
    public int insertStudent(String studentId) {
        AccountRole accountRole = new AccountRole();
        accountRole.setAccountId(studentId);
        accountRole.setId(IdUtil.getString(AccountRole.PRE_NAME));
        return accountRoleMapper.insertStudent(accountRole);
    }

    @Override
    public int insertCompany(String companyId) {
        AccountRole accountRole = new AccountRole();
        accountRole.setAccountId(companyId);
        accountRole.setId(IdUtil.getString(AccountRole.PRE_NAME));
        return accountRoleMapper.insertCompany(accountRole);
    }
}
